
function validate()
{
    

var xmlHttpRequest=init();
  var userid=document.getElementById("userid");
  var password=document.getElementById("password");
	xmlHttpRequest.open("GET", "loginvalidate?userid="+encodeURIComponent(userid.value)+"&password="+encodeURIComponent(password.value), true);
	          xmlHttpRequest.send(null);
          xmlHttpRequest.onreadystatechange=function()
         {
           if(xmlHttpRequest.readyState==4)

             {
                 
             var xmlMessage=xmlHttpRequest.responseXML;
             var valid=xmlMessage.getElementsByTagName("valid")[0].firstChild.nodeValue;
            if(valid=="true")
            {
            document.getElementById('lform').submit();
            }
            else
            {
             var validationMessage=document.getElementById("loginerror");
              validationMessage.innerHTML = "invalid entries";}
     }
 }
 return false;
}

function init()
  {
	if (window.XMLHttpRequest) 
		{
			return new XMLHttpRequest();
        } 
	else   
		{
           return new ActiveXObject("Microsoft.XMLHTTP");
        }

  }

